﻿@model StoreThemeSelectorModel

@inject Nop.Core.IWebHelper webHelper

@if (Model.AvailableStoreThemes.Count > 1)
{
    var returnUrl = webHelper.GetRawUrl(Context.Request);
    var themes = await Model.AvailableStoreThemes.SelectAwait(async x => new SelectListItem
    {
        Text = x.Title,
        Value = Url.Action("SetStoreTheme", "Common", new { themename = x.Name, returnUrl }, webHelper.GetCurrentRequestProtocol()),
        Selected = x.Name.Equals(Model.CurrentStoreTheme.Name, StringComparison.InvariantCultureIgnoreCase)
    }).ToListAsync();
    <div class="theme-selector">
        <select id="store-theme" name="store-theme" asp-items="@themes" onchange="setLocation(this.value);"></select>
    </div>
}